underscore prefix the mmx implementations, in order to not export them.
authorMatthias Clasen <mclasen@redhat.com>
Wed, 11 Aug 2004 14:23:31 +0000 (14:23 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 11 Aug 2004 14:23:31 +0000 (14:23 +0000)
2004-08-11  Matthias Clasen  <mclasen@redhat.com>

* pixops/pixops-internal.h:
* pixops/pixops.c:
* pixops/*.S: underscore prefix the mmx implementations, in order
to not export them.

* gdk-pixbuf.symbols: Remove the mmx pixops implementations.

* abicheck.sh: No need to define INCLUDE_MMX_SYMBOLS any more.

gdk-pixbuf/ChangeLog
gdk-pixbuf/abicheck.sh
gdk-pixbuf/gdk-pixbuf.symbols
gdk-pixbuf/pixops/composite_line_22_4a4_mmx.S
gdk-pixbuf/pixops/composite_line_color_22_4a4_mmx.S
gdk-pixbuf/pixops/have_mmx.S
gdk-pixbuf/pixops/pixops-internal.h
gdk-pixbuf/pixops/pixops.c
gdk-pixbuf/pixops/scale_line_22_33_mmx.S

index adf4104b6dcf1a76aa0feee18584e97dbe5e0941..14597bd37f3c3141fde763f8b7171abfc99975c6 100644 (file)
@@ -1,3 +1,14 @@
+2004-08-11  Matthias Clasen  <mclasen@redhat.com>
+
+       * pixops/pixops-internal.h: 
+       * pixops/pixops.c:
+       * pixops/*.S: underscore prefix the mmx implementations, in order
+       to not export them.
+
+       * gdk-pixbuf.symbols: Remove the mmx pixops implementations.
+
+       * abicheck.sh: No need to define INCLUDE_MMX_SYMBOLS any more.
+
 Tue Aug 10 23:53:59 2004  Matthias Clasen  <maclas@gmx.de>
 
        Add hidden aliases for exported symbols which are
index 9363c889d18bc63349f9139b2396f42f413d978d..1c6309f338d32508be92ec9290faed494d679e27 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
 
-cpp -P -DINCLUDE_INTERNAL_SYMBOLS -DINCLUDE_MMX_SYMBOLS gdk-pixbuf.symbols | sed -e '/^$/d' | sort > expected-abi
+cpp -P -DINCLUDE_INTERNAL_SYMBOLS gdk-pixbuf.symbols | sed -e '/^$/d' | sort > expected-abi
 nm -D .libs/libgdk_pixbuf-2.0.so | grep " T " | cut -c12- | grep "^\(gdk\|pixops\)_" | sort > actual-abi
 diff -u expected-abi actual-abi
index 5762b21036acef8144fa75a5930dfeaac51c74aa..100116355894367b91a401e6cf223ee82cbd0e64 100644 (file)
@@ -93,9 +93,3 @@ gdk_pixdata_deserialize
 gdk_pixdata_from_pixbuf
 gdk_pixdata_serialize
 gdk_pixdata_to_csource
-#ifdef INCLUDE_MMX_SYMBOLS
-pixops_composite_line_22_4a4_mmx
-pixops_composite_line_color_22_4a4_mmx
-pixops_have_mmx
-pixops_scale_line_22_33_mmx
-#endif
index a6e8d1943384e9849f51bce7e8975be8697e375c..fa67e9a90825fea0139ebbe99f508ea3c55d0015 100644 (file)
@@ -6,14 +6,14 @@ gcc2_compiled.:
 
 #if !defined(__MINGW32__) && !defined(__CYGWIN__)      
        
-.globl pixops_composite_line_22_4a4_mmx
-       .type    pixops_composite_line_22_4a4_mmx,@function
-pixops_composite_line_22_4a4_mmx:
+.globl _pixops_composite_line_22_4a4_mmx
+       .type    _pixops_composite_line_22_4a4_mmx,@function
+_pixops_composite_line_22_4a4_mmx:
        
 #else
        
-.globl _pixops_composite_line_22_4a4_mmx
-_pixops_composite_line_22_4a4_mmx:
+.globl __pixops_composite_line_22_4a4_mmx
+__pixops_composite_line_22_4a4_mmx:
        
 #endif
 /*
index 50ad00bd5ed6ddef8b0b251118080f79880a452d..8472f2f6fcaa10097b1fbcd6a768e93bca6c04e1 100644 (file)
@@ -6,14 +6,14 @@ gcc2_compiled.:
 
 #if !defined(__MINGW32__) && !defined(__CYGWIN__)      
 
-.globl pixops_composite_line_color_22_4a4_mmx
-       .type    pixops_composite_line_color_22_4a4_mmx,@function
-pixops_composite_line_color_22_4a4_mmx:
+.globl _pixops_composite_line_color_22_4a4_mmx
+       .type    _pixops_composite_line_color_22_4a4_mmx,@function
+_pixops_composite_line_color_22_4a4_mmx:
 
 #else
 
-.globl _pixops_composite_line_color_22_4a4_mmx
-_pixops_composite_line_color_22_4a4_mmx:
+.globl __pixops_composite_line_color_22_4a4_mmx
+__pixops_composite_line_color_22_4a4_mmx:
        
 #endif
 /*
index 4f8f5d87e3cafc39061ea0a13d37e02e229782dd..dbb0bd5f55c6faaf7efa4e77182c16b8d80b0443 100644 (file)
@@ -6,14 +6,14 @@ gcc2_compiled.:
 
 #if !defined(__MINGW32__) && !defined(__CYGWIN__)      
 
-.globl pixops_have_mmx
-       .type    pixops_have_mmx,@function
-pixops_have_mmx:
+.globl _pixops_have_mmx
+       .type    _pixops_have_mmx,@function
+_pixops_have_mmx:
 
 #else
 
-.globl _pixops_have_mmx
-_pixops_have_mmx:
+.globl __pixops_have_mmx
+__pixops_have_mmx:
 
 #endif
        
index bb0440f5ae9128bd6d2960f583004bd3811c8db8..3b09fc49ac43cc9cfa45ed9a5a39b5f8e386251e 100644 (file)
@@ -1,7 +1,7 @@
 #ifdef USE_MMX
-guchar *pixops_scale_line_22_33_mmx (guint32 weights[16][8], guchar *p, guchar *q1, guchar *q2, int x_step, guchar *p_stop, int x_init);
-guchar *pixops_composite_line_22_4a4_mmx (guint32 weights[16][8], guchar *p, guchar *q1, guchar *q2, int x_step, guchar *p_stop, int x_init);
-guchar *pixops_composite_line_color_22_4a4_mmx (guint32 weights[16][8], guchar *p, guchar *q1, guchar *q2, int x_step, guchar *p_stop, int x_init, int dest_x, int check_shift, int *colors);
-int pixops_have_mmx (void);
+guchar *_pixops_scale_line_22_33_mmx (guint32 weights[16][8], guchar *p, guchar *q1, guchar *q2, int x_step, guchar *p_stop, int x_init);
+guchar *_pixops_composite_line_22_4a4_mmx (guint32 weights[16][8], guchar *p, guchar *q1, guchar *q2, int x_step, guchar *p_stop, int x_init);
+guchar *_pixops_composite_line_color_22_4a4_mmx (guint32 weights[16][8], guchar *p, guchar *q1, guchar *q2, int x_step, guchar *p_stop, int x_init, int dest_x, int check_shift, int *colors);
+int _pixops_have_mmx (void);
 #endif
 
index 6f629d90ba2a150acf3d7f32ab5ca5c570d587ba..b235a4ac5d0932c8d403420ea05ede1d074cbe01 100644 (file)
@@ -71,35 +71,45 @@ pixops_scale_nearest (guchar        *dest_buf,
                      double         scale_x,
                      double         scale_y)
 {
-  int i, j;
+  int i;
   int x;
   int x_step = (1 << SCALE_SHIFT) / scale_x;
   int y_step = (1 << SCALE_SHIFT) / scale_y;
-
-#define INNER_LOOP(SRC_CHANNELS,DEST_CHANNELS)                         \
-      for (j=0; j < (render_x1 - render_x0); j++)              \
+  int xmax, xstart, xstop, x_pos, y_pos;
+  const guchar *p;
+
+#define INNER_LOOP(SRC_CHANNELS,DEST_CHANNELS,ASSIGN_PIXEL)    \
+      xmax = x + (render_x1 - render_x0) * x_step;              \
+      xstart = MIN (0, xmax);                                   \
+      xstop = MIN (src_width << SCALE_SHIFT, xmax);             \
+      p = src + (CLAMP (x, xstart, xstop) >> SCALE_SHIFT) * SRC_CHANNELS; \
+      while (x < xstart)                                        \
        {                                                       \
-         const guchar *p = src + (x >> SCALE_SHIFT) * SRC_CHANNELS;    \
-                                                               \
-         dest[0] = p[0];                                       \
-         dest[1] = p[1];                                       \
-         dest[2] = p[2];                                       \
-                                                               \
-         if (DEST_CHANNELS == 4)                               \
+         ASSIGN_PIXEL;                                         \
+         dest += DEST_CHANNELS;                                \
+         x += x_step;                                          \
+        }                                                       \
+      while (x < xstop)                                         \
            {                                                   \
-             if (SRC_CHANNELS == 4)                            \
-               dest[3] = p[3];                                 \
-             else                                              \
-               dest[3] = 0xff;                                 \
+         p = src + (x >> SCALE_SHIFT) * SRC_CHANNELS;          \
+         ASSIGN_PIXEL;                                         \
+         dest += DEST_CHANNELS;                                \
+         x += x_step;                                          \
            }                                                   \
-                                                               \
+      x_pos = x >> SCALE_SHIFT;                                 \
+      p = src + CLAMP (x_pos, 0, src_width - 1) * SRC_CHANNELS; \
+      while (x < xmax)                                          \
+        {                                                       \
+         ASSIGN_PIXEL;                                         \
          dest += DEST_CHANNELS;                                \
          x += x_step;                                          \
        }
 
   for (i = 0; i < (render_y1 - render_y0); i++)
     {
-      const guchar *src  = src_buf + (((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT) * src_rowstride;
+      y_pos = ((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT;
+      y_pos = CLAMP (y_pos, 0, src_height - 1);
+      const guchar *src  = src_buf + y_pos * src_rowstride;
       guchar       *dest = dest_buf + i * dest_rowstride;
 
       x = render_x0 * x_step + x_step / 2;
@@ -108,36 +118,25 @@ pixops_scale_nearest (guchar        *dest_buf,
        {
          if (dest_channels == 3)
            {
-             INNER_LOOP (3, 3);
+             INNER_LOOP (3, 3, dest[0]=p[0];dest[1]=p[1];dest[2]=p[2]);
            }
          else
            {
-             INNER_LOOP (3, 4);
+             INNER_LOOP (3, 4, dest[0]=p[0];dest[1]=p[1];dest[2]=p[2]);
            }
        }
       else if (src_channels == 4)
        {
          if (dest_channels == 3)
            {
-             INNER_LOOP (4, 3);
+             INNER_LOOP (4, 3, dest[0]=p[0];dest[1]=p[1];dest[2]=p[2];dest[3]=0xff);
            }
          else
            {
-             for (j=0; j < (render_x1 - render_x0); j++)
-               {
-                 const guchar *p = src + (x >> SCALE_SHIFT) * 4;
-                 guint32 *p32;
-
-                 p32 = (guint32 *) dest;
-                 *p32 = *((guint32 *) p);
-
-                 dest += 4;
-                 x += x_step;
-               }
+             INNER_LOOP(4, 4, guint32 *p32=(guint32*)dest;*p32=*((guint32*)p));
            }
        }
     }
-#undef INNER_LOOP
 }
 
 static void
@@ -159,23 +158,25 @@ pixops_composite_nearest (guchar        *dest_buf,
                          double         scale_y,
                          int            overall_alpha)
 {
-  int i, j;
+  int i;
   int x;
   int x_step = (1 << SCALE_SHIFT) / scale_x;
   int y_step = (1 << SCALE_SHIFT) / scale_y;
+  int xmax, xstart, xstop, x_pos, y_pos;
+  const guchar *p;
+  unsigned int  a0;
+
 
   for (i = 0; i < (render_y1 - render_y0); i++)
     {
-      const guchar *src  = src_buf + (((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT) * src_rowstride;
+      y_pos = ((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT;
+      y_pos = CLAMP (y_pos, 0, src_height - 1);
+      const guchar *src  = src_buf + y_pos * src_rowstride;
       guchar       *dest = dest_buf + i * dest_rowstride;
 
       x = render_x0 * x_step + x_step / 2;
       
-      for (j=0; j < (render_x1 - render_x0); j++)
-       {
-         const guchar *p = src + (x >> SCALE_SHIFT) * src_channels;
-          unsigned int  a0;
-
+      INNER_LOOP(src_channels, dest_channels,
          if (src_has_alpha)
            a0 = (p[3] * overall_alpha) / 0xff;
          else
@@ -218,9 +219,7 @@ pixops_composite_nearest (guchar        *dest_buf,
                 }
               break;
             }
-         dest += dest_channels;
-         x += x_step;
-       }
+       );            
     }
 }
 
@@ -254,14 +253,20 @@ pixops_composite_color_nearest (guchar        *dest_buf,
   int y_step = (1 << SCALE_SHIFT) / scale_y;
   int r1, g1, b1, r2, g2, b2;
   int check_shift = get_check_shift (check_size);
+  int xmax, xstart, xstop, x_pos, y_pos;
+  const guchar *p;
+  unsigned int  a0;
 
   for (i = 0; i < (render_y1 - render_y0); i++)
     {
-      const guchar *src  = src_buf + (((i + render_y0) * y_step + y_step/2) >> SCALE_SHIFT) * src_rowstride;
+      y_pos = ((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT;
+      y_pos = CLAMP (y_pos, 0, src_height - 1);
+      const guchar *src  = src_buf + y_pos * src_rowstride;
       guchar       *dest = dest_buf + i * dest_rowstride;
 
       x = render_x0 * x_step + x_step / 2;
       
+      
       if (((i + check_y) >> check_shift) & 1)
        {
          r1 = (color2 & 0xff0000) >> 16;
@@ -283,12 +288,8 @@ pixops_composite_color_nearest (guchar        *dest_buf,
          b2 = color2 & 0xff;
        }
 
-      for (j=0 ; j < (render_x1 - render_x0); j++)
-       {
-         const guchar *p = src + (x >> SCALE_SHIFT) * src_channels;
-          int a0;
-         int tmp;
-
+      j = 0;
+      INNER_LOOP(src_channels, dest_channels,
          if (src_has_alpha)
            a0 = (p[3] * overall_alpha + 0xff) >> 8;
          else
@@ -316,6 +317,8 @@ pixops_composite_color_nearest (guchar        *dest_buf,
              dest[2] = p[2];
               break;
             default:
+                    {
+                      unsigned int tmp;
               if (((j + check_x) >> check_shift) & 1)
                 {
                   tmp = ((int) p[0] - r2) * a0;
@@ -334,17 +337,18 @@ pixops_composite_color_nearest (guchar        *dest_buf,
                   tmp = ((int) p[2] - b1) * a0;
                   dest[2] = b1 + ((tmp + (tmp >> 8) + 0x80) >> 8);
                 }
+                    }
               break;
             }
          
          if (dest_channels == 4)
            dest[3] = 0xff;
 
-         dest += dest_channels;
-         x += x_step;
-       }
+                j++;
+       );
     }
 }
+#undef INNER_LOOP
 
 static void
 composite_pixel (guchar *dest, int dest_x, int dest_channels, int dest_has_alpha,
@@ -546,7 +550,7 @@ composite_line_22_4a4_mmx_stub (int *weights, int n_x, int n_y,
       mmx_weights[j][7] = 0x00010001 * (weights[4*j + 3] >> 8);
     }
 
-  return pixops_composite_line_22_4a4_mmx (mmx_weights, dest, src[0], src[1], x_step, dest_end, x_init);
+  return _pixops_composite_line_22_4a4_mmx (mmx_weights, dest, src[0], src[1], x_step, dest_end, x_init);
 }
 #endif /* USE_MMX */
 
@@ -691,8 +695,8 @@ composite_line_color_22_4a4_mmx_stub (int *weights, int n_x, int n_y,
   colors[2] = (color2 & 0xff00) << 8 | (color2 & 0xff);
   colors[3] = (color2 & 0xff0000) >> 16;
 
-  return pixops_composite_line_color_22_4a4_mmx (mmx_weights, dest, src[0], src[1], x_step, dest_end, x_init,
-                                                dest_x, check_shift, colors);
+  return _pixops_composite_line_color_22_4a4_mmx (mmx_weights, dest, src[0], src[1], x_step, dest_end, x_init,
+                                                 dest_x, check_shift, colors);
 }
 #endif /* USE_MMX */
 
@@ -842,7 +846,7 @@ scale_line_22_33_mmx_stub (int *weights, int n_x, int n_y,
       mmx_weights[j][7] = 0x00010001 * (weights[4*j + 3] >> 8);
     }
 
-  return pixops_scale_line_22_33_mmx (mmx_weights, dest, src[0], src[1], x_step, dest_end, x_init);
+  return _pixops_scale_line_22_33_mmx (mmx_weights, dest, src[0], src[1], x_step, dest_end, x_init);
 }
 #endif /* USE_MMX */
 
@@ -1385,7 +1389,7 @@ _pixops_composite_color (guchar         *dest_buf,
   PixopsLineFunc line_func;
   
 #ifdef USE_MMX
-  gboolean found_mmx = pixops_have_mmx();
+  gboolean found_mmx = _pixops_have_mmx ();
 #endif
 
   g_return_if_fail (!(dest_channels == 3 && dest_has_alpha));
@@ -1482,7 +1486,7 @@ _pixops_composite (guchar        *dest_buf,
   PixopsLineFunc line_func;
   
 #ifdef USE_MMX
-  gboolean found_mmx = pixops_have_mmx();
+  gboolean found_mmx = _pixops_have_mmx ();
 #endif
 
   g_return_if_fail (!(dest_channels == 3 && dest_has_alpha));
@@ -1558,7 +1562,7 @@ _pixops_scale (guchar        *dest_buf,
   PixopsLineFunc line_func;
 
 #ifdef USE_MMX
-  gboolean found_mmx = pixops_have_mmx();
+  gboolean found_mmx = _pixops_have_mmx ();
 #endif
 
   g_return_if_fail (!(dest_channels == 3 && dest_has_alpha));
index f389217ca04782c93c64db429f760097e4be597c..abdff6e83bd49f6ea3189836a9b7d62f4a90ffbd 100644 (file)
@@ -6,14 +6,14 @@ gcc2_compiled.:
 
 #if !defined(__MINGW32__) && !defined(__CYGWIN__)      
        
-.globl pixops_scale_line_22_33_mmx
-       .type    pixops_scale_line_22_33_mmx,@function
-pixops_scale_line_22_33_mmx:
+.globl _pixops_scale_line_22_33_mmx
+       .type    _pixops_scale_line_22_33_mmx,@function
+_pixops_scale_line_22_33_mmx:
        
 #else
        
-.globl _pixops_scale_line_22_33_mmx
-_pixops_scale_line_22_33_mmx:
+.globl __pixops_scale_line_22_33_mmx
+__pixops_scale_line_22_33_mmx:
        
 #endif
 /*